﻿using System;
using Notepad_X;
using Notepad_X.Plugin;

namespace Toolbar_Editor_Plugin
{
    public class Plugin : IPlugin
    {
        Editor myEditor;
        System.Windows.Forms.ToolStripMenuItem _menuItem;

        public string Name
        {
            get
            { return "Toolbar Editor"; }
        }
        public string Author
        {
            get
            { return "NohponeX"; }
        }
        public string Description
        {
            get
            { return "Toolbar Editor Plugin\nUpdated version 1.2"; }
        }
        public string Version
        {
            get
            { return "1.2"; }
        }
        public bool HasSettings {
            get { return true; }
        }

        public void Initialize()
        {
            _menuItem = new System.Windows.Forms.ToolStripMenuItem("Toolbars Editor");

            if (Notepad_X.Static.MainInstance.IconsCollection.Images.ContainsKey("toolbar"))
            {
                _menuItem.Image = Notepad_X.Static.MainInstance.IconsCollection.Images["toolbar"];
            }
            _menuItem.Click += new EventHandler(_menuItem_Click);
            Notepad_X.Static.MainInstance.system_menuItem_Get("Menu_Tools").DropDownItems.Insert(2, _menuItem);
        }
        public void Settings() {
            myEditor = new Editor();
             myEditor. Show();
        }

        void _menuItem_Click(object sender, EventArgs e)
        {
            Settings();
        }
        public void Dispose()
        {
            Notepad_X.Static.MainInstance.system_menuItem_Get("Menu_Tools").DropDownItems.Remove(_menuItem);
            if (myEditor != null)
            {
                myEditor.Dispose();
            }
            myEditor = null;
        }
    }
   
}
